﻿@model ThereAreNoIrreplaceblePeople.ViewModels.ProfileViewModel

@{
    ViewBag.Title = "Profile";
}

<h2>Profile</h2>

<script src="@Url.Content("~/Scripts/jquery.validate.min.js")" type="text/javascript"></script>
<script src="@Url.Content("~/Scripts/jquery.validate.unobtrusive.min.js")" type="text/javascript"></script>
<fieldset>
        <legend>Your hour counter: </legend>

        You have got <b>@Model.User.HourCounter</b> hours! 

        </fieldset>


@using (Html.BeginForm()) {
    @Html.ValidationSummary(true)
    <fieldset>
        <legend>User</legend>

        @Html.HiddenFor(model => model.User.Email)

        <div class="editor-label">
            @Html.LabelFor(model => model.User.FirstName)
        </div>
        <div class="editor-field">
            @Html.EditorFor(model => model.User.FirstName)
            @Html.ValidationMessageFor(model => model.User.FirstName)
        </div>

        <div class="editor-label">
            @Html.LabelFor(model => model.User.LastName)
        </div>
        <div class="editor-field">
            @Html.EditorFor(model => model.User.LastName)
            @Html.ValidationMessageFor(model => model.User.LastName)
        </div>

        <div class="editor-label">
            @Html.LabelFor(model => model.User.PhoneNumber)
        </div>
        <div class="editor-field">
            @Html.EditorFor(model => model.User.PhoneNumber)
            @Html.ValidationMessageFor(model => model.User.PhoneNumber)
        </div>

		<div class="editor-label">
            Your subjects: 
        </div>
		<div class="editor-field">
        <ul>
           @foreach (ThereAreNoIrreplaceblePeople.Models.Subject s in Model.ListOfSubjects)
           {
               <li>@s.CourseName <small>@Html.ActionLink("[delete]", "DeleteSubject", new { id = s.CourseCode })</small></li>
           }
           </ul>
        </div>
        <p>
            <input type="submit" value="Save" />
        </p>
    </fieldset>
}

<br />
<fieldset>
<legend>Add subject from the list</legend>
        @using (Html.BeginForm("AddNewSubjectFromList", "Account"))
        {
		<div class="editor-label">
            All subjects: 
        </div>
		<div class="editor-field">
		   @Html.DropDownListFor(model => model.SelectedSubject, new SelectList(Model.ListOfAllSubjects, "CourseCode", "CourseName"))
        </div>

        <p>
            <input type="submit" value="Add subject from list" />
        </p>
        }
        </fieldset>
        
        <br />
        <fieldset>
<legend>Add new subject</legend>
        @using (Html.BeginForm("AddNewSubject", "Account"))
        {
		<div class="editor-label">
            All subjects: 
        </div>
		<div class="editor-field">
		   @Html.TextBoxFor(model => model.SelectedSubject)
        </div>

        <p>
            <input type="submit" value="Add subject from list" />
        </p>
        }
        </fieldset>
<div>
    @Html.ActionLink("Back to List", "Index")
</div>
